//
//  CBGRepairViewController.m
//  chebabaGYS
//
//  Created by yisu on 15/12/24.
//  Copyright © 2015年 zhengminjie. All rights reserved.
//

#import "CBGRepairViewController.h"
//#import "LewPopupViewController.h"
#import "CustomDefine.h"
#import "CBGRepairViewController.h"
#import "CBGRepairDetailsVC.h"
#import "CBGRepairVC1.h"
#import "CBGRepairVC2.h"

@interface CBGRepairViewController ()<UITableViewDelegate, UITableViewDataSource>{

    
  UITableView *repairTableview;
}
@property (weak, nonatomic) IBOutlet UIView *view_;

@end

@implementation CBGRepairViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    repairTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, -64, __kWidth, __kHeight)];
    repairTableview.delegate = self;
    repairTableview.dataSource = self;
    repairTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view_ addSubview:repairTableview];
    
}
- (IBAction)backBtnAction:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)shuaixuanBtn:(id)sender {
}

#pragma mark - tableView的代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
//    CBMyRepairData *car = self.allRepairArr[indexPath.row];
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, __kWidth, 50)];
    [cell.contentView addSubview:view];
//
    UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(15, 5, 70, 20)];
    lab.font = MFont(13);
    lab.textColor = [UIColor orangeColor];
//    if (car.type == 2) {
        lab.text = @"【已取消】";
//    }else if (car.type == 4){
//        if (IsNilString(car.orderInfo)) {
//            lab.text = @"【待评价】";
//        }else{
//            lab.text = @"【已完成】";
//        }
//    }
    [view addSubview:lab];
//
    UILabel *lab1 = [[UILabel alloc]initWithFrame:CGRectMake(15, 25, 260, 20)];
    lab1.font = MFont(13);
//    lab1.text = [NSString stringWithFormat:@"%@  %@",car.brandName,car.modelsName];
    lab1.text = @"111";
     [view addSubview:lab1];
    
    UILabel *lab2 = [[UILabel alloc]initWithFrame:CGRectMake(15+70+5, 5, 200, 20)];
    lab2.font = MFont(13);
    //lab2.text = car.rushTime;
    lab2.text = @"222";
    [view addSubview:lab2];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   
    CBGRepairDetailsVC *repairVC = [[CBGRepairDetailsVC alloc] init];
    //判断状态的，进入抢修详情
    if (indexPath.row == 0) {
        repairVC.stringID = @"1";
        //抢修已评价完成
        UIViewController *VC = [self.storyboard instantiateViewControllerWithIdentifier:@"CBGRepairDetailsVC"];
        [self.navigationController pushViewController:VC animated:YES];

    }
    if (indexPath.row == 1) {
        repairVC.stringID = @"2";
       // 抢修待评价
        UIViewController *VC = [self.storyboard instantiateViewControllerWithIdentifier:@"CBGRepairVC1"];
        [self.navigationController pushViewController:VC animated:YES];

    }

    if (indexPath.row == 2) {
        repairVC.stringID = @"3";
        //取消抢修的原因
        UIViewController *VC = [self.storyboard instantiateViewControllerWithIdentifier:@"CBGRepairVC2"];
        [self.navigationController pushViewController:VC animated:YES];

    }
    }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
